package net.wanho.customerManage.dao.impl;

import net.wanho.commons.exception.DaoException;
import net.wanho.commons.exception.DataAccessException;
import net.wanho.commons.factory.BeanFactory;
import net.wanho.commons.util.JDBCTemplate;
import net.wanho.customerManage.dao.WorkingFieldDao;
import net.wanho.customerManage.po.LinkMan;
import net.wanho.customerManage.po.WorkingField;

import java.util.List;

public class WorkingFieldDaoImpl implements WorkingFieldDao {
    private JDBCTemplate jdbcTemplate = BeanFactory.getBean(JDBCTemplate.class) ;
    @Override
    public List<WorkingField> selectAllWorkingField() throws DaoException {
        final String SELECT_ALL_WORKING_FIELD_SQL = "SELECT \tFIELD_ID FIELDID, \n" +
                "\tFIELD_NAME FIELDNAME \n" +
                "\tFROM \n" +
                "\tworking_field " ;
        try {
            return jdbcTemplate.queryForList(SELECT_ALL_WORKING_FIELD_SQL, WorkingField.class);
        } catch (DataAccessException e) {
            e.printStackTrace();
            throw new DaoException(e.getMessage()) ;
        }
    }
}
